• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top | MCQs on Bitwise Algorithms and Bit Manipulations with Answers | Question 6

What is the output of the following code snippet?

C++
#include <iostream>
using namespace std;

void fun(int& num, int k) { num &= (~(1 << k)); }
int main()
{
    int num = 7;
    int k = 1;
    fun(num, k);
    cout << num << endl;
    return 0;
}

(A)

It will unset the all bits of num

(B)

It will clear all the bits of bits

(C)

It will unset the kth bit of num

(D)

None

Answer

Please comment below if you find anything wrong in the above post
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!

Last Updated :
Share your thoughts in the comments